package com.lixinxin.commoncomposeproject.repository

import com.lixinxin.commoncomposeproject.network.ApiClient
import com.lixinxin.commoncomposeproject.model.ArticleModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn

/**
 *   author ： lixinxin
 *   time    ： 2021-11-19
 *   email：895330766@qq.com
 */
class ArticleRepository {



    companion object {
        fun getArticle(page: Int): Flow<ArticleModel> =
            flow {
                val articleModel = ApiClient.apiService.articleList(page = page)
                emit(articleModel)
            }.flowOn(Dispatchers.IO)

    }

}